<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="issuedfileaction.DBConnection;"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>       
    <title>查询省份</title>    
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <%
      int PageSize;
      int TotalRow;
      int TotalPageCount;
      int currentPage;
      int BeginRow;
      int EndRow;
      String strPage;
      String ProvinceCode="";
      String ProvinceName="";
      String CurrentPage="";
      try{
          ProvinceCode=new String(request.getParameter("ProvinceCode").getBytes("ISO-8859-1"),"gbk");                  
      }catch(Exception e){
          ProvinceCode="";
      }   
      try{
          ProvinceName=new String(request.getParameter("ProvinceName").getBytes("ISO-8859-1"),"utf-8");                  
      }catch(Exception e){
          ProvinceName="";
      }
      try{
          CurrentPage=request.getParameter("CurrentPage");
      }catch(Exception e){
          CurrentPage="1";
      }
      DBConnection db=new DBConnection();
      String StrSql=" select * from (select a.regioncode,a.regionname,rownum m from (select regioncode,regionname,rownum c from region) a "
                   +" where 1=1 ";
      String StrTotalSql="select count(*) from region where 1=1 ";
      if((ProvinceCode!=null) && (!ProvinceCode.equals(""))){
         StrSql=StrSql+" and regioncode like '%"+ProvinceCode+"%' ";
         StrTotalSql=StrTotalSql+" and regioncode like '%"+ProvinceCode+"' ";
      }
      if((ProvinceName!=null) && (!ProvinceName.equals(""))){
         StrSql=StrSql+" and regionname like '%"+ProvinceName+"%' ";
         StrTotalSql=StrTotalSql+" and regionname like '%"+ProvinceName+"%' ";
      }
      PageSize=10;
      strPage=CurrentPage;
      if(strPage==null){
         currentPage=1;
      }else{
         currentPage=Integer.parseInt(strPage);
         if(currentPage<1)
            currentPage=1;
      }
      TotalRow=db.GetTotalRow(StrTotalSql);
      TotalPageCount=(TotalRow+PageSize-1)/PageSize;
      if(currentPage>TotalPageCount)
         currentPage=TotalPageCount;
      BeginRow=(currentPage-1)*PageSize+1;
      EndRow=currentPage*PageSize;      
      StrSql=StrSql+" order by regioncode)";
      StrSql=StrSql+" where m>="+BeginRow+" and m<="+EndRow+" ";
      Map<String,String> MapValue=new HashMap<String,String>();
      MapValue=db.GetMapValue(StrSql);
      HttpSession httpSession = request.getSession(); 
      httpSession.setAttribute("MapValueProvince", MapValue);
      httpSession.setAttribute("currentPage",String.valueOf(currentPage));
      httpSession.setAttribute("TotalPageCount",String.valueOf(TotalPageCount));
      httpSession.setAttribute("CustomerCode",ProvinceCode);
      httpSession.setAttribute("CustomerName",ProvinceName);		      		    	  
	  response.sendRedirect("ViewProvince.jsp");             
    %>
  </body>
</html>



























































